import request from "@/utils/request";
import { Notice } from "@/types/notice";

const baseApi = '/notices'

/**
 *  分页获取通知公告列表
 * @param params 
 * @returns 
 */
export function noticePagingApi(params:object) {
    return request({
      url: baseApi+'/paging',
      method: 'get',
      params
    })
  }

  /**
 * 新增或修改公告
 */
export function addOrUpdateNoticeApi(data:Notice) {
  return request({
      url: baseApi,
      method: data.id?'put':'post',
      data
  })
}

/**
* 删除公告
*/
export function deleteNoticeApi(id:number) {
  return request({
      url: baseApi+'/'+id,
      method: 'delete'
  })
}
/**
 * 批量删除公告
 * @param ids 
 * @returns 
 */
export function deleteBatchNoticeApi(ids:string) {
  return request({
      url: baseApi,
      method: 'delete',
      params: { ids }
  })
}
